home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1995 October
/
EnigmA AMIGA RUN 01 (1995)(G.R. Edizioni)(IT)[!][issue 1995-10][Aminet 7].iso
/
Aminet
/
comm
/
misc
/
avmNfax1_33.lha
/
AVMSuite
/
rexx
/
logfunctions.avm
< prev
next >
Wrap
Text File
|
1994-06-24
|
5KB
|
197 lines
exit
mailboxDir: procedure
parse arg mailbox
return 'avm:' || mailbox || '/'
logFile: procedure
parse arg mailbox, magiccookie
return 'avm:' || mailbox || '/logs/' || magiccookie
voiceFile: procedure
parse arg mailbox, magiccookie
if (verify(magiccookie, '/:', 'M') = 0) then
return 'avm:' || mailbox || '/voices/' || magiccookie
else
return magiccookie
makeUniqueFile: procedure
if arg() ~= 0 then do
rc = "makeUniqueFile: bad args"
signal error
end
return address() || '.' || date('i') || '.' || time('s') || '.' || random(1, 999, time('s'))
convertToDate: procedure
if arg() ~= 1 then do
rc = "convertToDate: bad args"
signal error
end
parse arg timeInC
actualTime = (timeInC - (2922)*86400) // (86400)
actualDate = (timeInC - actualTime - 2922*86400) % 86400
return actualDate /* returning it in 'internal' format */
convertToTime: procedure
if arg() ~= 1 then do
rc = "convertToTime: bad args"
signal error
end
parse arg timeInC
actualTime = (timeInC - (2922)*86400) // (86400)
return actualTime
cTime: procedure
/* 2922 = 8*365 + 2 */
/* 86400 = 24*60*60 */
return (date('i')+2922)*86400 + time('s')
/* this returns a handle that you must use after initializing log. */
initLogEntry: procedure expose log.
if arg() ~= 0 then do
rc = "initLogEntry: bad args"
signal error
end
drop log.
log. = ''
acidname = getclip(address() || 'CIDNAME')
acidnumber = getclip(address() || 'CIDNUMBER')
/* 2922 = 8*365 + 2 */
/* 86400 = 24*60*60 */
log.time = (date('i')+2922)*86400 + time('s')
log.cidname = acidname
log.cidnumber = acidnumber
return
loadLogEntry: procedure expose log.
if arg() ~= 2 then do
rc = "loadLogEntry: bad args"
signal error
end
parse arg mailbox, handle
drop log.
log. = ''
if ~exists(mailboxDir(mailbox)) then do
call showDebugger('Dir=' || mailboxDir(mailbox) 'does not exist')
return
end
opened = open(handle, logFile(mailbox, handle), 'r')
if opened then do
call showDebugger('Loading entry' logFile(mailbox, handle))
do while ~eof(handle)
line = readln(handle)
parse upper var line variable '=' value
log.variable = value
end
call close(handle)
end; else call showDebugger('Could not load' logFile(mailbox, handle))
return
/* pass a handle here */
saveLogEntry: procedure expose log.
if arg() ~= 2 then do
rc = "saveLogEntry: bad args"
signal error
end
parse arg mailbox, handle
if ~exists(mailboxDir(mailbox)) then do
call showDebugger('Dir=' || mailboxDir(mailbox) 'does not exist')
return
end
opened = open(handle, logFile(mailbox, handle), 'w')
if opened then do
call showDebugger('Saving entry' logFile(mailbox, handle))
call writeln(handle, 'TYPE=' || log.type)
call writeln(handle, 'TIME=' || log.time)
call writeln(handle, 'LENGTH=' || log.length)
call writeln(handle, 'ORIGMAILBOX=' || log.origmailbox)
call writeln(handle, 'CIDNAME=' || log.cidname)
call writeln(handle, 'CIDNUMBER=' || log.cidnumber)
call writeln(handle, 'COMMENT=' || log.comment)
call writeln(handle, 'FILENAME=' || log.filename)
call writeln(handle, 'ALTFILENAME=' || log.altfilename)
call writeln(handle, 'RETURNNUMBER=' || log.returnnumber)
call writeln(handle, 'RETURNSENDFUNC=' || log.returnsendfunc)
call writeln(handle, 'RETURNSTATUS=' || log.returnstatus)
call writeln(handle, 'RETURNRETRY=' || log.returnretry)
call writeln(handle, 'RETURNINTERVAL=' || log.returninterval)
call close(handle)
address rexx 'broadcast' 'addtomailbox' mailbox handle
end; else call showDebugger('Could not save' logFile(mailbox, handle))
return
/* pass a handle here */
updateLogEntry: procedure expose log.
if arg() ~= 2 then do
rc = "updateLogEntry: bad args"
signal error
end
parse arg mailbox, handle
if ~exists(mailboxDir(mailbox)) then do
call showDebugger('Dir=' || mailboxDir(mailbox) 'does not exist')
return
end
if ~exists(logFile(mailbox, handle)) then do
call showDebugger('Unable to update non-existent' logFile(mailbox, handle))
return
end
opened = open(handle, logFile(mailbox, handle), 'w')
if opened then do
call showDebugger('Updating entry' logFile(mailbox, handle))
call writeln(handle, 'TYPE=' || log.type)
call writeln(handle, 'TIME=' || log.time)
call writeln(handle, 'LENGTH=' || log.length)
call writeln(handle, 'ORIGMAILBOX=' || log.origmailbox)
call writeln(handle, 'CIDNAME=' || log.cidname)
call writeln(handle, 'CIDNUMBER=' || log.cidnumber)
call writeln(handle, 'COMMENT=' || log.comment)
call writeln(handle, 'FILENAME=' || log.filename)
call writeln(handle, 'ALTFILENAME=' || log.altfilename)
call writeln(handle, 'RETURNNUMBER=' || log.returnnumber)
call writeln(handle, 'RETURNSENDFUNC=' || log.returnsendfunc)
call writeln(handle, 'RETURNSTATUS=' || log.returnstatus)
call writeln(handle, 'RETURNRETRY=' || log.returnretry)
call writeln(handle, 'RETURNINTERVAL=' || log.returninterval)
call close(handle)
address rexx 'broadcast' 'refreshmailboxentry' mailbox handle
end; else call showDebugger('Could not update' logFile(mailbox, handle))
return